'use strict';

angular.module('biblioApp')
    .controller('AddCtrl', ['$scope','Localization', 'Adding', function ($scope, Localization, Adding) {

...

    $scope.changeLocalization = function(code) {
        Localization.changeLocalization(code);
    };

    $scope.getLocalizationCode = function(){
        return Localization.code;
    };

    $scope.validateChosenYear = function(){
        var date = new Date();
        var year = date.getFullYear();

        if ( +$scope.bookData.year >= 1800 && +$scope.bookData.year <= year ) {
            $scope.addbook.year.$setValidity('year', true);
        }
        else {
            $scope.addbook.year.$setValidity('year', false);
        }
    };

  }]);
